<template>
    <MyHead title="" @click-left="goback()">
    </MyHead>
    <div v-if="list">
        <van-card v-for="item in list" :price="item.originprice" :desc="item.desc" :title="item.proname" :thumb="item.img3"
            @click="godetaile(item.proid)" />
    </div>
    <div v-else>没有找到该商品</div>
</template>

<script lang="ts" setup>
import { useCommon } from '../hooks/useCommon'
import { search } from '../api/pro'
import { onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { ref } from 'vue'
import router from '@/router';

const list = ref()
const route = useRoute()
const { goback } = useCommon()
onMounted(() => {
    search(1, 10, route.params.brand).then(res => {
        console.log(res)
        if (res.code == '200') {
            list.value = res.data
        }
    })
})

const godetaile = (proid) => {
    router.push(`/detaile/${proid}`)
}
</script>